﻿var hdnCheckvalidationString = $("#hdnCheckvalidationString").val();
var hdnCheckvalidationInteger = $("#hdnCheckvalidationInteger").val();
var hdnCheckvalidationEmail = $("#hdnCheckvalidationEmail").val();
var hdnCheckvalidationAddress = $("#hdnCheckvalidationAddress").val();
var hdnCheckvalidationTitle = $("#hdnCheckvalidationTitle").val();
var signUp = "signUp";

var hdnTick = $("#hdnTick").val();
var hdnCross = $("#hdnCross").val();

var hdnCheckvalidationPostcode = $("#hdnCheckvalidationPostcode").val();

$('.checkvalidationstring').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);
    if (getValue != '') {
        $(this).removeClass("errorforaccordian");
        $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationString,
            success: function (msg) {
                if (msg == 1) {

                    getthis.next().html('<img src=' + hdnTick + ' />');
                    $('#loadingmessage').hide();
                }
                else {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                }
            }
        });
    }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
    }
});

$('.checkvalidationinteger').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);
    if (getValue != '') {
        $(this).removeClass("errorforaccordian");
        $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationInteger,
            success: function (msg) {
                if (msg == 1) {

                    getthis.next().html('<img src=' + hdnTick + ' />');
                    $('#loadingmessage').hide();
                }
                else {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                }
            }
        });
   
     }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
     }
});



$('.CheckvalidationPostCode').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);
    if (getValue != '') {
        $(this).removeClass("errorforaccordian");
        $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationPostcode,
            success: function (msg) {
                if (msg == 1) {

                    getthis.next().html('<img src=' + hdnTick + ' />');
                    $('#loadingmessage').hide();
                }
                else {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                }
            }
        });

    }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
    }
});



$('.checkvalidationemail').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);
    if (getValue != '') {
        $(this).removeClass("errorforaccordian");
        $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationEmail,
            success: function (msg) {
                if (msg == 1) {

                    getthis.next().html('<img src=' + hdnTick + ' />');
                    $('#loadingmessage').hide();
                    $("#spnEmailExists").hide();
                }
                else if (msg == 2) {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                    $("#spnEmailExists").show();
                    getthis.val(' ');
                }
                else {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                    $("#spnEmailExists").hide();
                }
            }
        });
    }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
    }
});


$('.checkvalidationAddress').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);
    if (getValue != '') {
        $(this).removeClass("errorforaccordian");
        $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationAddress,
            success: function (msg) {
                getthis.next().html('<img src=' + hdnTick + ' />');
                $('#loadingmessage').hide();
            }
        });
    }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
    }
});


$('.checkvalidationtitle').live('blur', function () {
    var getValue = '';
    getValue = $(this).val();
    getthis = $(this);

    if (getValue != '') {
     $(this).removeClass("errorforaccordian");
      $('#loadingmessage').show();
        $.ajax({
            type: "GET",
            data: { matchValue: getValue },
            url: hdnCheckvalidationTitle,
            success: function (msg) {
                if (msg == 1) {

                    getthis.next().html('<img src=' + hdnTick + ' />');
                    $('#loadingmessage').hide();
                }
                else {
                    getthis.next().html('<img src=' + hdnCross + ' />');
                    $('#loadingmessage').hide();
                }
            }
        });
    }
    else {
        $(this).addClass("errorforaccordian");
        getthis.next().html('');
        $('#loadingmessage').hide();
    }
});
